<!doctype html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
    <link rel="stylesheet" href="../../css/aui.css">
    <link rel="stylesheet" href="../../css/aliance.css">
    <link rel="stylesheet" href="../../css/pulice.css">
    <script src="../../js/api.js"></script>
    <script src="../../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="../../js/libs/swiper.min.js"></script>
    <script src="../../js/vue.min.js"></script>
    <script src="../../js/vue-resource.min.js"></script>
    <script src="../../js/aui-toast.js"></script>
    <script src="../../js/common.js" type="text/javascript" charset="utf-8"></script>
    <style type="text/css">
    	.appBox {
		    padding: 0 1rem;
		    border: 1px dashed rgb(204, 204, 204);
		    margin: 1.4rem 0.6rem 0;
		    background: #fff;
		    height: 13rem;
		}
    </style>
    <script>
		setToken();
		
		//获得参数(只对字母数字等有效,参数值为中文则不能传)
			function getQueryString(name) {
				var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
				var r = window.location.search.substr(1).match(reg);
				if(r != null) return unescape(r[2]);
				return null;
			}
			var shopId = getQueryString('shopId');　　
			
			
        $(function () {
            var app = new Vue({
                el: '#appBox',
                data: {
                    fenlei: [],
                    goods:[],
                    paySuccess : '',
                },
                mounted:function(){
                	this.$nextTick(function(){
                		this.myDetail();
                	})
                },
                methods:{
                	ensure : function(){
                		var val = $('#input-1').val();
                		console.log(val)
                		this.$http.get(SURL+"app/score/orderStore",{params:{"shopId": shopId,"payMoney": val, "scoreRatio": '100' }}).then(function(res){
                				console.log(res)
	                   			var obj1 = res.body.data;
	                   			var str = sessionStorage.setItem('sqjs', JSON.stringify(obj1));
	                   			if(res.body.status  == 1){
	                   				window.location.href = 'IntegralOrder.html'
	                   			}
	                		}).catch(function(req){
                			
                		});
                		
                	},
                	myDetail: function() {
							this.$http.get(SURL + "app/shops/storeInfo", {
								params: {
									"shopId": shopId
								}
							}).then(function(res) {
								console.log(res.body.data)
								this.goods = res.body.data;
								
							}).catch(function(req) {

							});

						},
                	
                }
            });

            $('.hm-bar').load('../../data/headerOther.html',function (data) {
                $(this).find('.head-main').text('申请积分');
                $(this).find('.hm-bar-box').css('position','static');
                $(this).find('.head-left').on('tap',function () {
                    window.history.back();
                });
            });
            $('.footer').load('../../data/footer.html');


        })
    </script>
    <title>申请积分</title>
</head>

<body>
	<div class="hm-bar"></div>
    <div class="appBox" id="appBox">
        <div class="appShop">
            <img :src="orImg(imgUrl + goods.userPhoto)" alt=""/>
            <span>{{goods.shopName}}</span>
        </div>
        <div class="zfMoney bdb1">
            <label class="font-base-14" for="input-1">本次已支付金额（<span class="lmRed">￥</span>）</label>
            <input class="font-base-12" id="input-1" type="number" oninput="if(value.length > 11)value = value.slice(0, 11)" placeholder="请输入支付金额" v-model="paySuccess">
        </div>
        <div class="zfMoney bdb1">
            <label class="font-base-14">商家赠送积分比例</label>
            <div class="zfTxt font-base-12">
                {{goods.scoreRatio}}%
            </div>
        </div>
        <div class="zfMoney">
            <label class="font-base-14">可申请积分</label>
            <div class="zfTxt font-base-12">
                {{paySuccess*goods.scoreRatio}}
            </div>
        </div>
        <div class="btnBlue font-base-14" v-on:click="ensure">确认</div>
    </div>
</body>
</html>